<template>
  <div class="leftSidebar">
    <sidebar-item
      v-for="(str, index) in list"
      :title="str"
      :index="index"
      :active-inx="selectIndex"
      @item-click="itemClick(index)"
    ></sidebar-item>
  </div>
</template>

<script>
import sidebarItem from "./sidebarItem";
import router from "../../../router";
export default {
  name: "leftSidebar",
  components: { sidebarItem },
  data: function () {
    return {
      selectIndex: 0,
      list: ["个人处方", "诊所处方", "常用医嘱"],
    };
  },
  mounted: function () {
    console.log(this.$route.path);

    if (this.$route.path.indexOf("templates") != -1) {
      this.selectIndex = 0;
    }
  },
  methods: {
    itemClick: function (index) {
      this.selectIndex = index;
      // let str = "payDrug"
      // switch (this.selectIndex) {
      //     case 0:
      //         str = "payDrug";
      //         break;
      // }
      // this.$router.push({name:str});
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/assets/scss/templates/modules/leftSidebar.scss";
</style>
